home *** CD-ROM | disk | FTP | other *** search
- #include "SequenceGrab.h"
-
- //////////
- //
- // PutFile
- // Save a file under the specified name. Return Boolean values indicating whether the user selected a file
- // and whether the selected file is replacing an existing file.
- //
- //////////
-
- OSErr PutFile(ConstStr255Param thePrompt, ConstStr255Param theFileName, FSSpecPtr theFSSpecPtr, Boolean *theIsSelected, Boolean *theIsReplacing)
- {
- #if TARGET_OS_WIN32
- StandardFileReply myReply;
- #endif
- #if TARGET_OS_MAC
- NavReplyRecord myReply;
- NavDialogOptions myDialogOptions;
- NavEventUPP myEventUPP = NULL; // NewNavEventUPP(HandleNavEvent);
- #endif
- OSErr myErr = noErr;
-
- if ((theFSSpecPtr == NULL) || (theIsSelected == NULL) || (theIsReplacing == NULL))
- return(paramErr);
-
- // assume we are not replacing an existing file
- *theIsReplacing = false;
-
- #if TARGET_OS_WIN32
- StandardPutFile(thePrompt, theFileName, &myReply);
- *theFSSpecPtr = myReply.sfFile;
- *theIsSelected = myReply.sfGood;
- if (myReply.sfGood)
- *theIsReplacing = myReply.sfReplacing;
- #endif
-
- #if TARGET_OS_MAC
- // specify the options for the dialog box
- NavGetDefaultDialogOptions(&myDialogOptions);
- myDialogOptions.dialogOptionFlags += kNavNoTypePopup;
- myDialogOptions.dialogOptionFlags += kNavDontAutoTranslate;
- BlockMoveData(theFileName, myDialogOptions.savedFileName, theFileName[0] + 1);
- BlockMoveData(kApplicationName, myDialogOptions.clientName, kApplicationName[0] + 1);
- BlockMoveData(thePrompt, myDialogOptions.message, thePrompt[0] + 1);
-
- // prompt the user for a file
- myErr = NavPutFile(NULL, &myReply, &myDialogOptions, myEventUPP, MovieFileType, sigMoviePlayer, NULL);
- if ((myErr == noErr) && myReply.validRecord) {
- AEKeyword myKeyword;
- DescType myActualType;
- Size myActualSize = 0;
-
- // get the FSSpec for the selected file
- if (theFSSpecPtr != NULL)
- myErr = AEGetNthPtr(&(myReply.selection), 1, typeFSS, &myKeyword, &myActualType, theFSSpecPtr, sizeof(FSSpec), &myActualSize);
-
- NavDisposeReply(&myReply);
- }
-
- *theIsSelected = myReply.validRecord;
- if (myReply.validRecord)
- *theIsReplacing = myReply.replacing;
-
- DisposeNavEventUPP(myEventUPP);
- #endif
-
- return(myErr);
- }
-
- //////////
- //
- // QTFrame_HandleNavEvent
- // A callback procedure that handles events while a Navigation Service dialog box is displayed.
- //
- //////////
-
- PASCAL_RTN void HandleNavEvent (NavEventCallbackMessage theCallBackSelector, NavCBRecPtr theCallBackParms, void *theCallBackUD)
- {
- #pragma unused(theCallBackUD)
- WindowReference myWindow = NULL;
-
- if (theCallBackSelector == kNavCBEvent) {
- switch (theCallBackParms->eventData.eventDataParms.event->what) {
- case updateEvt:
- #if TARGET_OS_MAC
- // Handle Update Event
- #endif
- break;
- case nullEvent:
- // Handle null Event
- break;
- }
- }
- }